package com.qijian.common.utils.easyexcel.dto;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author gw
 */
@Data
public class ExcelListenDynamicResolve {
    private Object uniqueKey;
    private List<ExcelColumnIndexMapping> mapping;

    @Data
    public static class ExcelColumnIndexMapping {
        private Integer index;
        private Object uniqueKey;
        private String desc;

        public ExcelColumnIndexMapping(Integer index, Object uniqueKey, String desc) {
            this.index = index;
            this.uniqueKey = uniqueKey;
            this.desc = desc;
        }
    }

    public void add(Integer index, Object uniqueKey, String desc) {
        if (this.mapping == null) {
            this.mapping = new ArrayList<>();
        }
        this.mapping.add(new ExcelColumnIndexMapping(index, uniqueKey, desc));
    }
}
